// *****************************************************************************************
//
// Copyright (c) 2012. Lin Gui, Ocean University of China and Carneggie Mellon University.
// This code may be used, distribute, or modified only for research purposes or under
// license from Ocean University of China or Carnegie Mellon University. This notice must
//  be retained in all copies.
//
// *****************************************************************************************

/*!
  \file         taskcontroller.h
  \author       Lin Gui
  \version      1.0
  \date         2012/1/4
  \brief        Header file for task selecter window
*/

#ifndef TASKCONTROLLER_H
#define TASKCONTROLLER_H

#define DEBUG
#define STRUCTEDLIGHTFILE "structedlight.inf"

#include <QWidget>
#include <QLabel>
#include <QPushButton>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QList>
#include <QTimer>
#include <QDesktopWidget>
#include <QString>
#include <QColor>
#include <QButtonGroup>
#include <QLineEdit>
#include <QKeyEvent>

#include "fullscreenclock.h"
#include "fullscrstructedlight.h"
#include "drawcircle.h"
#include "drawimage.h"
#include "scaningcircle.h"

class TaskController : public QWidget
{
    Q_OBJECT

public:
    TaskController(int tScreen, bool vDesktop, int pScreenNo, QDesktopWidget* dWidget);
    ~TaskController();

    // Draw the window content and initialize
    void initWindow();
    int readLightList(QString filename);

private:
    int totalScreen;
    int primeScreen;
    bool isVirtualDesktop;
    QDesktopWidget * desktop;

    QLabel * screensLabel;
    QPushButton * showClock;
    QPushButton * showStructedLight;
    QPushButton * drawCircle;
    QPushButton * drawRing;
    QPushButton * drawDImage;
    QPushButton * drawSImage;
//    QButtonGroup * radioGroup;
    QPushButton * startScaCircle;
    QPushButton * closeAll;

    QVBoxLayout * mainVLayout;
    QVBoxLayout * taskVLayout;
    QHBoxLayout * sLightHLayout;
    QHBoxLayout * dCircleHLayout;
    QVBoxLayout * dImageVLayout;
    QHBoxLayout * scaCircleHLayout;

    QLineEdit * xInput;
    QLineEdit * yInput;
    QLineEdit * radInput;
    QLineEdit * rInput;
    QLineEdit * gInput;
    QLineEdit * bInput;
    QLineEdit * widthInput;

    QVBoxLayout * dcLocVLayout;
    QVBoxLayout * lineVLayout;
    QVBoxLayout * dcButVLayout;

    QHBoxLayout * locXHLayout;
    QHBoxLayout * locYHLayout;
    QHBoxLayout * radHLayout;

    QHBoxLayout * redHLayout;
    QHBoxLayout * greenHLayout;
    QHBoxLayout * blueHLayout;
    QHBoxLayout * widthHLayout;

    QLineEdit * sCirRadInput;
    QLineEdit * sCirLWInput;
    QLineEdit * sCirInvInput;
    QLineEdit * sCirRInput;
    QLineEdit * sCirGInput;
    QLineEdit * sCirBInput;

    QVBoxLayout * scaCirParVLayout;
    QVBoxLayout * scaCirColorVLayout;

    QHBoxLayout * sCRadiusHLayout;
    QHBoxLayout * sCLWHLayout;
    QHBoxLayout * sInvHLayout;
    QHBoxLayout * sCRHLayout;
    QHBoxLayout * sCGHLayout;
    QHBoxLayout * sCBHLayout;

    //Lists
    QList <FullScreenClock*> * fullscrClockList;
    QList <FullscrStructedLight*> * fullscrSLightList;
    QList <DrawCircle*> * fullscrCircleList;
    QList <DrawImage*> * fullscrImageList;
    QList <ScaningCircle*> * scanCircleList;

    QTimer * myTimer;
//    QTimer * mySCTimer;
    QList <QColor> * colorList;
    QList <int> * widthList;

    void closeAllWin();

private slots:
    void onShowClock();
    void onShowStructedLight();
    void onDrawCircle();
    void onDrawRing();
    void onDrawDImage();
    void onDrawSImage();
    void onStartScanCircle();
    void onCloseAll();
};

#endif // TASKCONTROLLER_H
